package cn.changshengjue.dakong.command.sub;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.scheduler.BukkitRunnable;

import cn.changshengjue.dakong.main;
import cn.changshengjue.dakong.command.SubCommand;
import cn.changshengjue.dakong.command.type.AdminCommand;
import cn.changshengjue.dakong.config.cfg;
import cn.changshengjue.dakong.utils.YmlUtil;

public class StartCommand extends SubCommand {
	public StartCommand() {
		super("start", "/dk start", main.getInstance().getConfig().getString("commands.start"));
	}

	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		YmlUtil ymlUtil = new YmlUtil();
		File file = ymlUtil.getFile("playerDate.yml");
		FileConfiguration fileMine = ymlUtil.getFileMine(file);
		fileMine.set(sender.getName(), !fileMine.getBoolean(sender.getName()));
		ymlUtil.saveFiles(file, fileMine);
		if (fileMine.getBoolean(sender.getName())) {
			sender.sendMessage(cfg.MSG_PLUGIN + cfg.MSG_STARTTRUE);
		} else {
			sender.sendMessage(cfg.MSG_PLUGIN + cfg.MSG_STARTFALSE);
		}
		return false;
	}

	@Override
	public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
		return null;
	}

	public static void main(String[] args) {
		System.out.println(Math.pow(0.01, 10));
	}
}
